﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ToaThuoc_PAK.UserControls
{
    public partial class menu : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // Put user code to initialize the page here
            lhoten.Text = "Khách";
            if (Session["HoTen"] != null)
            {
                lhoten.Text = Session["HoTen"].ToString();
            }
            if (Session["tenkhoa"] != null)
            {
                khoamenu.Text = Session["tenkhoa"].ToString();
            }
            if (Session["phong"] != null)
            {
                phongmenu.Text = Session["phong"].ToString();
            }
        }

        #region Web Form Designer generated code
        override protected void OnInit(EventArgs e)
        {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
            base.OnInit(e);
        }

        /// <summary>
        ///		Required method for Designer support - do not modify
        ///		the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {

        }
        #endregion

        protected void lbThoat_Click(object sender, System.EventArgs e)
        {
            //phongkhamlogin log=new phongkhamlogin();
            //string tdb=log.Database;
            //log.Database=log.VienPhiDB;
            //SqlConnection sqlcon=new SqlConnection(log.ConnectionString);
            //SqlCommand sqlcom=new SqlCommand();
            //log.Database=tdb;
            //sqlcom.Connection=sqlcon;
            //string makhoa="";
            //string phong="";
            //if (Session["makhoa"]!=null){makhoa=Session["makhoa"].ToString().Trim().Replace("'","''");}
            //if (Session["phong"]!=null){phong=Session["phong"].ToString().Trim().Replace("'","''");}
            //string strdongphong=" Update ThongTinBanKham Set DangHoatDong=0, BacSi='' where Khoa=N'"+makhoa+"' and BanKham=N'"+phong+"' ";
            //sqlcom.CommandText=strdongphong;
            //sqlcon.Open();
            //sqlcom.ExecuteNonQuery();			
            //sqlcon.Close();
            //lhoten.Text="Khách";
            //Session.Abandon();
            ////Server.Transfer("WebForm1.aspx?trang=logout");			
            //Response.Redirect("thoat.aspx");	
            Session.Abandon();
            Response.Redirect("dangnhap.aspx");
        }
        protected void lbDangNhap_Click(object sender, EventArgs e)
        {
            Session.Abandon();
            Response.Redirect("dangnhap.aspx");
        }
    }
}